<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: Ringo Chan <334258471@qq.com> <http://www.jxlnxx.com/>
// +----------------------------------------------------------------------

namespace Api\Controller;
use Think\Controller;

/**
 * API公共控制器
 * 为防止多分组Controller名称冲突，公共Controller名称统一使用分组名称
 */
class ApiController extends Controller {
    
    /* 空操作，用于输出404页面 */
	public function _empty(){
		response(-97);
	}
	
	protected function _initialize(){  
	    !IS_POST && response(-99);
	    
	    /* 读取数据库中的配置 */
	    $config =   S('DB_CONFIG_DATA');
	    if(!$config){
	        $config =   api('Config/lists');
	        S('DB_CONFIG_DATA',$config);
	    }
	    C($config); //添加配置
	
	    if(!C('WEB_SITE_CLOSE')){
	        $this->error('站点已经关闭，请稍后访问~');
	    }
	}
	
	protected function api_login(){
	    $token = I('post.token');
	    
	    return api_login($token);
	}

    protected function passed_login(){
	    $token = I('post.token');

        return passed_login($token);
    }

    protected function only_login(){
        $token = I('post.token');

        return only_login($token);
    }


}
?>